package com.hbl.hhb.mysql;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

public class AppjdbcDelete {
    public static void main(String[] args) throws Exception {
        //1.加载驱动类
        Class.forName("com.mysql.jdbc.Driver");
        //2.获取链接
        String url = "jdbc:mysql://localhost:3306/test?useSSL=false";
        String username = "root";
        String password = "hhb20010721.";
        Connection connection = DriverManager.getConnection(url, username, password);
        Statement statement = connection.createStatement();
        String sql = "DELETE FROM `user` WHERE id=1";
        int i=statement.executeUpdate(sql);
        if (i > 0) {
            System.out.println("删除成功！");
        }
    }

}